package top.lyc829.mymusic.model.db

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import top.lyc829.mymusic.MyApp
import top.lyc829.mymusic.model.bean.Banner

/**
 * @Author lyc
 * @create 2021-07-06 14:16
 */
@Database(entities = [Banner::class], version = 1, exportSchema = false)
abstract class MyDataBase : RoomDatabase() {

    abstract fun getBannerDao() : BannerDao

    companion object{
        val instance = Single.sin
    }
    private object Single{
        val sin: MyDataBase = Room.databaseBuilder(
            MyApp.context,
            MyDataBase::class.java,
            "music.db"
        )
            .allowMainThreadQueries()
            .build()
    }
}